﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Cataloger
{
    public partial class FrmWybDostepnosci : Form
    {
        public FrmWybDostepnosci()
        {
            InitializeComponent();
        }
        public FrmWybDostepnosci(Nosnik n):this()
        {
            this.Text = n.Nazwa;
            this.comboBox1.Text = n.Status.ToString();
            this.comboBox1.SelectedItem = n.Status.ToString();
        }
        public DostepnoscNosnika Dostepnosc
        {
            get
            {
                DostepnoscNosnika dost=DostepnoscNosnika.Dostepny;
                switch (comboBox1.SelectedItem.ToString())
                {
                    case "Dostepny":
                        {
                            dost= DostepnoscNosnika.Dostepny;
                        }
                        break;
                    case "Pozyczony":
                        {
                            dost = DostepnoscNosnika.Pozyczony;
                        }
                        break;
                    case "TrwalyBrak":
                        {
                            dost = DostepnoscNosnika.TrwalyBrak;
                        }
                        break;
                    case "Wypozyczony":
                        {
                            dost = DostepnoscNosnika.Wypozyczony;
                        }
                        break;
                    default:
                        break;
                }
                return dost;
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}
